import {computed, ref} from "vue";
import {ElMessageBox} from "element-plus";
import {Face} from "./components/hada-canvas-poster/types";




export const menuActiveIndex = ref('cleanAll');



export function menuHandleSelect(key: string, keyPath: string[]) {
    console.log(key, keyPath, 'menuHandleSelect');

    /**
     *       <view class="menu-btn" @click="clearAll">
     *         <el-button>清空所有元素</el-button>
     *       </view>
     *       <view class="menu-btn" @click="loadPsd">加载psd</view>
     */
}

export const showTemplates=ref(false);

/**
 * 左侧菜单显示激活
 */
export const leftOpenActive=ref('');

export const leftOpenHand = (active:string)=>{
    if(leftOpenActive.value === active){
        leftOpenActive.value = '';
    }else{
        leftOpenActive.value = active;
    }
}

const leftMenuAll=ref(['add','allComponent','fonts','code']);
/**
 * 左侧菜单打开
 */
export const leftOpen= computed(()=>{
    return leftMenuAll.value.includes(leftOpenActive.value);
});


export const addFont=(faces : Face[])=>{
    faces.push({
        name: '',
        url: ''
    })
}

export const deleteFont=(faces : Face[],item: Face,i : number)=>{
    faces.splice(i,1);
}



